#include "firstwidget.h"
#include "ui_firstwidget.h"
#include <QLabel>
#include <QObject>
#include <QPushButton>

FirstWidget::FirstWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FirstWidget)
{
    ui->setupUi(this);

    QLabel *label = new QLabel(this);
    label->setGeometry(QRect(160, 150, 72, 15));
    label->setText("hellowlrld");

    QPushButton *button = new QPushButton(this);
    button->setGeometry(QRect(160 + 72 + 10, 150, 72, 15));

    connect(button, &QPushButton::clicked, this, &FirstWidget::buttonClicked);
}

FirstWidget::~FirstWidget()
{
    delete ui;
}

void FirstWidget::buttonClicked()
{
    QPushButton *button = dynamic_cast<QPushButton *>(sender());
    if (button != nullptr) {
        tr("button!");
    }
    qDebug("buttonClicked!");
}
